﻿using Sample.Novel.Domain.Shared.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;

namespace Sample.Novel.Domain.Shared
{
    [DependsOn(
        typeof(AbpLocalizationModule),
        typeof(AbpVirtualFileSystemModule),
        typeof(AbpLocalizationAbstractionsModule)
        )]
    public class NovelDomainSharedModule
        :AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure<AbpVirtualFileSystemOptions>(options =>
            {
                options.FileSets.AddEmbedded<NovelDomainSharedModule>();
            });

            Configure<AbpLocalizationOptions>(options =>
            {
                options.Resources
                    .Add<NovelResource>("zh-Hans")
                    .AddVirtualJson("/Localization/Novel")
                    .AddBaseTypes(typeof(AbpValidationResource)); //Inherit from an existing resource

            });

            Configure<AbpLocalizationOptions>(options =>
            {
                options.DefaultResourceType = typeof(NovelResource);
            });

            Configure<AbpExceptionLocalizationOptions>(options =>
            {
                options.MapCodeNamespace("Novel", typeof(NovelResource));
            });
        }
    }
}
